<?php
	class Calculette
	{
		private $result;
		
		public function __construct()
		{
			$this->result = 0;
		}
		
		public function cal(array $number, $operateur)
		{
			$ret = $this->result;
			foreach ($number as $value)
			{
				switch ($operateur)
				{
					case '+': $this->result += $value; $ret .= ' + '; break;
					case '-': $this->result -= $value; $ret .= ' - '; break;
					case '*': $this->result *= $value; $ret .= ' * '; break;
					case '/': $this->result /= $value; $ret .= ' / '; break;
				}
				$ret .= $value;
			}
			echo $ret.' = '.$this->result.'<br/>';
			return $this->result;
		}
		
		public function getLastResult()
		{
			echo $this->result;
			return $this->result;
		}
	}
?>